﻿using AbpApplication.InPut;
using NewWms.Apiservice;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace NewWms.ViewModels.DialogsModel
{
    public class CreateWarehouseDialogModel : BindableBase, IDialogAware
    {
        public DelegateCommand<string> Command { get; set; }

        private InPut_BaseService3 inPut_BaseServie3;
        public InPut_BaseService3 InPut_BaseServie3
        {
            get { return inPut_BaseServie3; }
            set { inPut_BaseServie3 = value; RaisePropertyChanged(); }
        }
        private  IBaseService baseService;
        public CreateWarehouseDialogModel() 
        {
            Command = new DelegateCommand<string>(Method);
            InPut_BaseServie3=new InPut_BaseService3();
            baseService = new BaseService();
        }
        public async void Method(string obj)
        {
            switch (obj)
            {
                case "CloseDialog": RequestClose?.Invoke(null); break;
                case "CreateWarehouse": CreateWarehouses(); break;
            }
        }

        private async void CreateWarehouses()
        {
            await baseService.Create_Warehouses(InPut_BaseServie3);
        }
















        public string Title { get; set; } = "新建仓库";
        public event Action<IDialogResult> RequestClose;
        public bool CanCloseDialog()
        {
            return true;
        }
        public void OnDialogClosed()
        {
            
        }
        public void OnDialogOpened(IDialogParameters parameters)
        {
            
        }
    }
}
